package com.wyt.common.logger;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @Description:
 * @Author wangyongtao
 * @Date 2022/1/26 14:04
 **/
public class ExceptionUtils {

    public static String getAllException(Exception e) {
        try (StringWriter stringWriter = new StringWriter();) {
            e.printStackTrace(new PrintWriter(stringWriter));
            return stringWriter.toString();
        } catch (Exception e1) {
            return e.getMessage();
        }
    }

    public static String getSimpleException(Exception e) {
        return e.toString() + ":" + e.getMessage();
    }

}
